<?php
// +-------------------------------------------------------------------------------
// | DingZone [ A Rapid Development Framework For Dingtalk ]
// +-------------------------------------------------------------------------------
// | 钉钉微应用创建及修改请求类 v1.0
// |
// | Copyright (c) 2014-2018 http://www.heimalanshi.com All rights reserved.
// | Author : Jie
// | Date : 2018-08-09
// +-------------------------------------------------------------------------------

namespace ding\request;


class MicroappSaveRequest extends DingApiRequest {
    /**
     * 微应用id
     * @var string
     */
    private $agentId;
    /**
     * 微应用的图标。需要调用上传接口将图标上传到钉钉服务器后获取到的mediaId
     * @var string
     */
    private $appIcon;
    /**
     * 微应用的名称。长度限制为1~10个字符
     * @var string
     */
    private $appName;
    /**
     * 微应用的描述。长度限制为1~20个字符
     * @var string
     */
    private $appDesc;
    /**
     * 微应用的移动端主页，必须以http开头或https开头
     * @var string
     */
    private $homepageUrl;
    /**
     * 微应用的PC端主页，必须以http开头或https开头，如果不为空则必须与homepageUrl的域名一致
     * @var string
     */
    private $pcHomepageUrl;
    /**
     * 微应用的OA后台管理主页，必须以http开头或https开头
     * @var string
     */
    private $ompLink;

    /**
     * 构造函数对外隐藏
     */
    private function __construct() {
    }

    /**
     * 新建微应用请求
     *
     * @param $appIcon
     * @param $appName
     * @param $appDesc
     * @param $homepageUrl
     * @return static
     */
    public static function microappCreateRequest($appIcon, $appName, $appDesc, $homepageUrl) {
        $req = new static();
        $req->appIcon = $appIcon;
        $req->appName = $appName;
        $req->appDesc = $appDesc;
        $req->homepageUrl = $homepageUrl;
        return $req;
    }

    /**
     * 更新微应用的请求
     *
     * @param $agentId
     * @param $appIcon
     * @param $appName
     * @param $appDesc
     * @param $homepageUrl
     * @return static
     */
    public static function microappUpdateRequest($agentId, $appIcon, $appName, $appDesc, $homepageUrl) {
        $req = new static();
        $req->agentId = $agentId;
        $req->appIcon = $appIcon;
        $req->appName = $appName;
        $req->appDesc = $appDesc;
        $req->homepageUrl = $homepageUrl;
        return $req;
    }

    /**
     * @return string
     */
    public function getAgentId() {
        return $this->agentId;
    }

    /**
     * @param string $agentId
     * @return MicroappSaveRequest
     */
    public function setAgentId($agentId) {
        $this->agentId = $agentId;
        return $this;
    }

    /**
     * @return string
     */
    public function getAppIcon() {
        return $this->appIcon;
    }

    /**
     * @param string $appIcon
     * @return MicroappSaveRequest
     */
    public function setAppIcon($appIcon) {
        $this->appIcon = $appIcon;
        return $this;
    }

    /**
     * @return string
     */
    public function getAppName() {
        return $this->appName;
    }

    /**
     * @param string $appName
     * @return MicroappSaveRequest
     */
    public function setAppName($appName) {
        $this->appName = $appName;
        return $this;
    }

    /**
     * @return string
     */
    public function getAppDesc() {
        return $this->appDesc;
    }

    /**
     * @param string $appDesc
     * @return MicroappSaveRequest
     */
    public function setAppDesc($appDesc) {
        $this->appDesc = $appDesc;
        return $this;
    }

    /**
     * @return string
     */
    public function getHomepageUrl() {
        return $this->homepageUrl;
    }

    /**
     * @param string $homepageUrl
     * @return MicroappSaveRequest
     */
    public function setHomepageUrl($homepageUrl) {
        $this->homepageUrl = $homepageUrl;
        return $this;
    }

    /**
     * @return string
     */
    public function getPcHomepageUrl() {
        return $this->pcHomepageUrl;
    }

    /**
     * @param string $pcHomepageUrl
     * @return MicroappSaveRequest
     */
    public function setPcHomepageUrl($pcHomepageUrl) {
        $this->pcHomepageUrl = $pcHomepageUrl;
        return $this;
    }

    /**
     * @return string
     */
    public function getOmpLink() {
        return $this->ompLink;
    }

    /**
     * @param string $ompLink
     * @return MicroappSaveRequest
     */
    public function setOmpLink($ompLink) {
        $this->ompLink = $ompLink;
        return $this;
    }


}